/*
 * Created by Jaren at 2021/8/21 14:40
 */
class EzcanConstant {
  static const int DUL_WHEEL_DEVICE_PC = 0x11;
  static const int DUL_WHEEL_DEVICE_MC = 0x12;

  static const int EUC_DEVICE_PC = 0x21;
  static const int EUC_DEVICE_MC = 0x22;

  static const int SCOOTER_DEVICE_PC = 0x31;
  static const int SCOOTER_DEVICE_MC = 0x32;

  static const int E_BIKE_DEVICE_PC = 0x31;
  static const int E_BIKE_DEVICE_MC = 0x32;

  static const int HEAD1 = 0xAA;
  static const int HEAD2 = HEAD1;
  static const int TAIL1 = 0x55;
  static const int TAIL2 = TAIL1;

  static const int CHANNEL_LOCAL = 0x05;

  static const int FORMAT_STANDARD = 0x00;
  static const int FORMAT_EXTRA = 0x01;

  static const int TYPE_READ = 0x01;
  static const int TYPE_WRITE = 0x00;

  static const int LENGTH_FLAG_EXTRA = 0xFE;

  static const int MAX_DATA_LENGTH = 8;

  static const int CHAR1_NEED_ESCAPE = 0x55;
  static const int CHAR2_NEED_ESCAPE = 0xAA;
  static const int CHAR3_NEED_ESCAPE = 0xA5;
  static const int ESCAPE_CHAR = 0xA5;

  static const int ID_CONFIGURATION = 0x0f3B0207; // 配置参数，用于早期车型
  static const int ID_SETTINGS = 0x0F550115; // 系统设置
  static const int ID_FAST_DATA = 0x0F550113; // 快速数据
  static const int ID_SLOW_DATA = 0x0F550114; // 慢速数据
  static const int ID_VERIFY_PWD = 0x0F550307; // 验证密码
  static const int ID_CHANGE_PWD = 0x0F550306; // 修改密码
  static const int ctrlIdCalibration = 0x0f550119; // 校准
  static const int CTRL_ID_WIPE_DATA = 0x0f550120; // 擦除数据

  static const int ID_REMOTE_CTRL = 0x0f550116; // 模拟遥控器
  static const int ID_LIGHT = 0x0f55010d; // 灯光开关
  static const int ID_HANDLE = 0x0F55012E; // 提手开关
  static const int ID_QUICK_CONNECT_REQUST = 0x0f060101; // V10秒连确认请求
  static const int ID_QUICK_CONNECT_RSP = 0x0f060102; // V10秒连确认应答
  static const int ID_STATISTICS = 0x0f550132; // V10统计数据
  static const int ID_MODE = 0x0f550132; // 模式
  static const int ID_VOLUME = 0x0f55060A; // 设置/获取音量大小
  static const int ID_SHORTCUT_SWITCH = 0x0f55012E; // 读写快捷操作方式开关
  static const int ID_LANGUAGE = 0x0f550124; // 语言配置
  static const int ID_GPS_STATE = 0x0f550110; // GPS开关配置
  static const int ID_GLIDE_TIME = 0x0f550A08; // 滑板车滑行一次加速时间
  static const int ID_GLIDE_START_STATE = 0x0f550A02; // 滑板车滑行启动开关状态
  static const int ID_LAST_EVENT = 0x0f550126; // 上次报错时间
  static const int idGetLogFileInfo = 0x0f55050A; // 日志文件信息
  static const int idOpenLogFile = 0x0f55050B; // 打开日志文件
  static const int idGetLogFileContent = 0x0f55050C; // 打开日志文件
  static const int idCloseLogFile = 0x0f55050D; // 关闭日志文件
  static const int idDeleteLogFile = 0x0f55050E; // 删除日志文件
  static const int idOpenFile = 0x0f120201; // 打开或创建文件
  static const int idSetFileOffset = 0x0f120202; // 设置文件写入偏移量
  static const int idWriteFile = 0x0f120203; // 发送文件数据
  static const int idCloseFile = 0x0f120204; // 关闭文件
  static const int idLightEffectId = 0x0f550b05; // 获取/设置当前灯效id
  static const int idLightEffects = 0x0f550b06; // 灯效列表
  static const int idLightEffectColor = 0x0f550b09; // 获取氛围灯颜色
  static const int idSoundPackState = 0x0f55010e; // 音效设置
  static const int idSoundPackId = 0x0f550611; // 获取当前音效ID
  static const int ID_MUSIC_STORAGE_INFO = 0x0f55060D; // 获取音效存储空间容量
  static const int ID_OPEN_MUSIC_INFO = 0x0f55060B; // 打开指定音效文件
  static const int ID_MUSIC_ITEM_FILE_OFFSET = 0x0f55060B; // 音效文件offset
  static const int idPlayMusic = 0x0f550609; // 播放指定的音乐
  static const int ID_CLOSE_MUSIC_FILE = 0x0f55060F; // 关闭音乐文件
  static const int ID_TURN_STEERING_ANGLE_0 = 0x0f550119; // 转向零点
  static const int ID_ASSISTANCE_SETTINGS = 0x0f0b0301; // 助力车设置项
  static const int idSyncRTC = 0x0f550106; // 重置时间戳/校准RTC
  static const int idL8AccParams = 0x003B050C; // L8参数配置

  static const int REMOTE_CTRL_MODE = 0xb2; // 控制操作-模式

  static const int ctrlModelLock = 0x03;
  static const int ctrlModelUnlock = 0x04;
  static const int CTRL_MODE_POWER_OFF = 0x05;
  static const int ctrlModeCruiseOn = 0x06;
  static const int ctrlModeCruiseOff = 0x07;
  static const int CTRL_MODE_HORN = 0x11;
  static const int CTRL_MODE_LIGHT_ON = 0x0B;
  static const int CTRL_MODE_LIGHT_OFF = 0x0C;
  static const int CTRL_MODE_BLDC = 0x0D;
  static const int CTRL_MODE_FOC = 0x0E;
  static const int ctrlModeLightEffectOn = 0x0F;
  static const int ctrlModeLightEffectOff = 0x10;
  static const int CTRL_MODE_TRANSPORT_ON = 0x12;
  static const int CTRL_MODE_TRANSPORT_OFF = 0x13;

  static const int MODE_OVER_SPEED_WARNING_ON = 0x17;
  static const int MODE_OVER_SPEED_WARNING_OFF = 0x18;

  static const int WORK_MODE_IDLE = 0x00;
  static const int WORK_MODE_DRIVE = 0x01;
  static const int WORK_MODE_AUTO_ZERO = 0x02;
  static const int WORK_MODE_LARGE_ANGLE = 0x03;
  static const int WORK_MODE_SELF_CHECK = 0x04;
  static const int WORK_MODE_LOCK = 0x05;
  static const int WORK_MODE_ERROR = 0x06;
  static const int WORK_MODE_ASSISTANCE = 0x07;
  static const int WORK_MODE_REMOTE_CTRL = 0x08;
  static const int WORK_MODE_SHUTDOWN = 0x09;
  static const int WORK_MODE_PWM_STOP = 0x10;
  static const int WORK_MODE_UNLOCK = 0x11;
  static const int WORK_MODE_UNKNOWN = 0x7F;

  static const int SETTINGS_ID_ANGLE_Z = 0;
  static const int SETTINGS_ID_MAX_SPEED = 1;
  static const int SETTINGS_ID_STEERING_SENSITIVITY = 4;
  static const int SETTINGS_ID_PEDAL_SENSITIVITY = 6;
  static const int SETTINGS_ID_STANDBY_TIME = 9;
  static const int settingsIdDriveMode = 10;

  static const int SETTING_DRIVE_MODE_COMFORT = 0x1; // 设置-骑行模式
  static const int SETTING_DRIVE_MODE_CLASSIC = 0x0; // 设置-骑行模式

  static const int CONFIGURATION_ANGLE_Z = 0x0; // 配置信息-前后零点偏移
  static const int CONFIGURATION_MAX_SPEED = 0x01; // 配置信息-最大速度
  static const int CONFIGURATION_TURNING_SENSITIVITY = 0x04; // 配置信息-转向灵敏度
  static const int CONFIGURATION_PEDAL_SENSITIVITY = 0x06; // 配置信息-踏板灵敏度
  static const int CONFIGURATION_WAIT_TIME = 0x09; // 配置信息-无动作关机时间
  static const int CONFIGURATION_DRIVE_MODE = 0x0A; // 配置信息-骑行模式

  static const int SN_INDEX_IN_SLOW_DATA = 0;
  static const int PC_VERSION_INDEX_IN_SLOW_DATA = 24;
  static const int MC_VERSION_INDEX_IN_SLOW_DATA = 32;
  static const int ANGLE_Z_INDEX_IN_SLOW_DATA = 56; // 前后偏移量
  static const int CRUISE_STATUS_INDEX_IN_SLOW_DATA = 56;
  static const int MAX_SPEED_INDEX_IN_SLOW_DATA = 60;
  static const int TURNING_SENSITIVITY_INDEX_IN_SLOW_DATA = 72; // 转向灵敏度
  static const int LIGHT_STATUS_INDEX_IN_SLOW_DATA = 80;
  static const int ACTION_SOUND_STATE_INDEX_IN_SLOW_DATA = 84; // 提示音开关
  static const int GPS_STATE_INDEX_IN_SLOW_DATA = 88; // GPS开关
  static const int CAR_MODEL_INDEX_IN_SLOW_DATA = 104;
  static const int CAR_SERIES_INDEX_IN_SLOW_DATA = 107;
  static const int BATTERY_LIMIT_INDEX_IN_SLOW_DATA = 108;
  static const int PEDAL_SENSITIVITY_INDEX_IN_SLOW_DATA = 124; // 踏板灵敏度
  static const int VOLUME_INDEX_IN_SLOW_DATA = 125; // 音量大小
  static const int HANDLE_STATE_INDEX_IN_SLOW_DATA = 129; // 提手开关
  static const int LIGHT_EFFECT_STATE_INDEX_IN_SLOW_DATA = 130; // 灯效开关
  static const int WAIT_TIME_INDEX_IN_SLOW_DATA = 131; // 无操作后关机等待时间
  static const int DRIVE_MODE_INDEX_IN_SLOW_DATA = 132; // 骑行模式

  static const int SN_LENGTH_IN_SLOW_DATA = 8;
  static const int VERSION_LENGTH_IN_SLOW_DATA = 4;
  static const int MAX_SPEED_LENGTH_IN_SLOW_DATA = 4;

  static const int SPEED_LEFT_INDEX_IN_FAST_DATA = 12;
  static const int SPEED_RIGHT_INDEX_IN_FAST_DATA = 16;
  static const int ELECTRICITY_INDEX_IN_FAST_DATA = 20;
  static const int VOLTAGE_INDEX_IN_FAST_DATA = 24;
  static const int MOTOR_TEMPERATURE_L_INDEX_IN_FAST_DATA = 34;
  static const int MOTOR_TEMPERATURE_R_INDEX_IN_FAST_DATA = 35;
  static const int TOTAL_MILEAGE_INDEX_IN_FAST_DATA = 44;
  static const int THIS_TIME_MILEAGE_INDEX_IN_FAST_DATA = 48;
  static const int WORK_MODE_INDEX_IN_FAST_DATA = 60;
  static const int PHASE_CURRENT1_INDEX_IN_FAST_DATA = 64;
  static const int PHASE_CURRENT2_INDEX_IN_FAST_DATA = 68;
  static const int BATTERY_LEVEL_INDEX_IN_FAST_DATA = 83;
  static const int TEMPERATURE_INDEX_IN_FAST_DATA = 100;
  static const int TOTAL_ENERGY_INDEX_IN_FAST_DATA = 103;
  static const int THIS_TIME_ENERGY_INDEX_IN_FAST_DATA = 111;
  static const int POWER_OUT_INDEX_IN_FAST_DATA = 141;
  static const int POWER_IN_INDEX_IN_FAST_DATA = 143;
  static const int TORQUE_INDEX_IN_FAST_DATA = 145;
  static const int ACCELERATION_INDEX_IN_FAST_DATA = 147;

  static const int VOLTAGE_LENGTH_IN_FAST_DATA = 4;
  static const int MILEAGE_LENGTH_IN_FAST_DATA = 8;
  static const int MILEAGE_V10_LENGTH_IN_FAST_DATA = 4;
  static const int WORK_MODE_LENGTH_IN_FAST_DATA = 4;

  static const int LANGUAGE_ENGLISH = 0;
  static const int LANGUAGE_CHINESE = 1;

  static const int PEDAL_SENSITIVITY_LEVEL_HARD = 2;
  static const int PEDAL_SENSITIVITY_LEVEL_MID = 3;
  static const int PEDAL_SENSITIVITY_LEVEL_SOFT = 4;

  static const double ANGLE_Z_UNIT = 65536.0;

  static const int UPLOAD_FILE_TYPE_FIRMWARE = 0x0;
  static const int UPLOAD_FILE_TYPE_SOUND = 0x01;
  static const int UPLOAD_FILE_TYPE_LIGHT = 0x02;

  static const int LIGHT_STYLE_TAIL_LIGHT = 12;

  static const int MUTE_ENABLED = 1;
  static const int MUTE_DISABLED = 0;

  static const int ASSISTANCE_MAX_POWER_PERCENT = 100;

  static const int ASSISTANCE_MODE_NONE = 0;
  static const int ASSISTANCE_MODE_GENERAL = 8;
  static const int ASSISTANCE_MODE_MAX = 28;

  static const int R1_TURNING_SENSITIVITY_MIN = 20;
  static const int R1_TURNING_SENSITIVITY_MAX = 200;

  static const String DEFAULT_BLE_PWD = "000000";

  static const int RESULT_OK = 1;
}